<!-- main -->
<div class="row">
    <div class="col-sm-12">
        <div class="box box-primary">
            <div class="box-header with-border">
                <div class="box-title">
                    <button class="btn btn-primary" (click)="toggleModel('addModel')">新增</button>
                    <button class="btn btn-primary" (click)="getTeacherList('open',null)">分配导师</button>
                </div>
            </div>
            <!-- 搜索框 -->
            <div class="box-header">
                <form class="form-inline">
                    <div class="col-sm-12">
                        <div class="form-group search-input-R1">
                            <label for="SstudentId">学号</label>
                            <input type="text" id="SstudentId" class="form-control" [(ngModel)]="searchBody.StudentId" name="SstudentId">
                        </div>
                        <div class="form-group search-input-R1">
                            <label for="SstudentGrade">年级</label>
                            <input type="text" id="SstudentGrade" class="form-control" [(ngModel)]="searchBody.StudentGrade" name="SstudentGrade">
                        </div>
                        <div class="form-group search-input-R1">
                            <label for="SstudentDepartment">系别</label>
                            <input type="text" id="SstudentDepartment" class="form-control" [(ngModel)]="searchBody.StudentDepartment" name="SstudentDepartment">
                        </div>
                        <div class="form-group search-input-R1">
                            <label for="SstudentMajor">专业</label>
                            <input type="text" id="SstudentMajor" class="form-control" [(ngModel)]="searchBody.StudentMajor" name="SstudentMajor">
                        </div>
                    </div>
                    <div class="form-group search-input-R2">
                        <label for="SteacherName">导师姓名</label>
                        <input type="text" id="SteacherName" class="form-control" [(ngModel)]="searchBody.TeacherName" name="SteacherName">
                    </div>

                    <div class="form-group search-input-R2">
                        <label for="SselectStatus">选题状态</label>
                        <select class="form-control" id="SselectStatus" [(ngModel)]="searchBody.SelectStatus" name="SselectStatus">
                            <option value="0">未选题</option>
                            <option value="1">待确认</option>
                            <option value="2">已选题</option>
                        </select>
                    </div>
                    <div class="form-group search-input-R2">
                        <label for="SreadStatus">查阅状态</label>
                        <select class="form-control" id="SreadStatus" [(ngModel)]="searchBody.ReadStatus" name="SreadStatus">
                            <option value="0">未查阅</option>
                            <option value="1">已查阅</option>
                        </select>
                    </div>

                    <div class="form-group search-input-R2">
                        <label for="Slevel">评级</label>
                        <select class="form-control" id="Slevel" [(ngModel)]="searchBody.Level" name="Slevel">
                            <option value="0">未评级</option>
                            <option value="1">不合格</option>
                            <option value="2">合格</option>
                            <option value="3">优秀</option>
                        </select>
                    </div>
                    <div class="form-group search-input-R2">
                        <button type="submit" (click)="getStudentList(1)" class="btn btn-primary btn-margin-right">查询</button>
                        <button type="submit" (click)="clearSearch()" class="btn btn-warning">重置</button>
                    </div>
                </form>
            </div>
            <!-- table -->
            <div class="box-body table-scroll-content table-responsive">
                <table id="studentTable" class="table table-bordered table-hover table-striped table-keep-line">
                    <thead>
                        <tr>
                            <th>
                                <div class="checkbox checkbox-primary">
                                    <input type="checkbox" name="checkall" [(ngModel)]="checkall" (ngModelChange)="checkAll()"><label></label>
                                </div>
                            </th>
                            <th>年级</th>
                            <th>系别</th>
                            <th>专业</th>
                            <th>学号</th>
                            <th>姓名</th>
                            <th>导师工号</th>
                            <th>导师姓名</th>
                            <th>选题状态</th>
                            <th>编号</th>
                            <th>题目</th>
                            <th>关键字</th>
                            <th>查阅状态</th>
                            <th>系统评分</th>
                            <th>论文评分</th>
                            <th>总分</th>
                            <th>评级</th>
                            <th>毕业年份</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let student of studentList">
                            <td>
                                <div class="checkbox checkbox-primary">
                                    <input type="checkbox" name="checkbox" [(ngModel)]="student.isChecked"><label></label>
                                </div>
                            </td>
                            <td>{{student.StudentGrade}}</td>
                            <td>{{student.StudentDepartment}}</td>
                            <td>{{student.StudentMajor}}</td>
                            <td>{{student.StudentId}}</td>
                            <td><a (click)="showStudent(student,'stu')">{{student.StudentName}}</a></td>
                            <td>{{student.TeacherId}}</td>
                            <td><a (click)="showStudent(student,'teach')">{{student.TeacherName}}</a></td>
                            <td *ngIf="student.SelectStatus==0 || student.SelectStatus==null" style="color:red">未选题</td>
                            <td *ngIf="student.SelectStatus==1" style="color:#FF7B00">待确认</td>
                            <td *ngIf="student.SelectStatus==2" style="color:green">已选题</td>
                            <td>{{student.TitleId}}</td>
                            <td>{{student.TitleName}}</td>
                            <td>{{student.KeyWord}}</td>
                            <td *ngIf="student.ReadStatus==0 || student.ReadStatus==null" style="color:red">未查阅</td>
                            <td *ngIf="student.ReadStatus==1" style="color:green">已查阅</td>
                            <td>{{student.SystemScore}}</td>
                            <td>{{student.TitleScore}}</td>
                            <td>{{student.Score}}</td>
                            <td *ngIf="student.Level==0 || student.Level==null" style="color:gray">未评级</td>
                            <td *ngIf="student.Level==1" style="color:red">不合格</td>
                            <td *ngIf="student.Level==2" style="color:blue">合格</td>
                            <td *ngIf="student.Level==3" style="color:orange">优秀</td>
                            <td>{{student.Graduation}}</td>
                            <td>
                                <button class="btn btn-xs btn-primary" (click)="toggleModel('editModel',student)">编辑</button>
                                <button class="btn btn-xs btn-danger" (click)="delStudent(student)">删除</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!-- 底部页面跳转 -->
            <div class="box-footer clearfix">
                <p class="pull-left">每页
                    <select [(ngModel)]="searchBody.PageSize" (ngModelChange)="getStudentList(1)" name="pagesize">
                        <option value="10">10</option>
                        <option value="20">20</option>
                        <option value="30">30</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                        <option value="200">200</option>
                    </select>个 - 共{{searchBody.Total}}个 - 当前显示第{{searchBody.PageIndex}}页
                </p>
                <ul class="pagination pagination-sm no-margin pull-right">
                    <li (click)="changePage('first',null)"><a>首页</a></li>
                    <li (click)="changePage('pre',null)"><a class="fa fa-chevron-left"></a></li>
                    <li *ngFor="let item of pages" (click)="changePage('page',item)" [class.active]="searchBody.PageIndex===item"><a>{{item}}</a></li>
                    <li (click)="changePage('next',null)"><a class="fa fa-chevron-right"></a></li>
                    <li (click)="changePage('last',null)"><a>末页</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>

<!-- 新增模版 -->
<div class="modal fade" id="addModel" tabindex="-1" role="dialog" aria-labelledby="新增">
    <div class="modal-dialog" role="document">
        <div class="modal-content col-sm-12">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">新增</h4>
            </div>
            <div class="modal-body">
                <form class="form-inline" #addForm="ngForm">
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentGrade">年级</label>
                        <input type="text" class="form-control" id="AstudentGrade" placeholder="学生年级" required [(ngModel)]="addStudentModel.StudentGrade"
                            name="AstudentGrade">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentDepartment">系别</label>
                        <input type="text" class="form-control" id="AstudentDepartment" placeholder="学生系别" required [(ngModel)]="addStudentModel.StudentDepartment"
                            name="AstudentDepartment">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentMajor">专业</label>
                        <input type="text" class="form-control" id="AstudentMajor" placeholder="学生专业" required [(ngModel)]="addStudentModel.StudentMajor"
                            name="AstudentMajor">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentId">学号</label>
                        <input type="text" class="form-control" id="AstudentId" placeholder="学生学号" required [(ngModel)]="addStudentModel.StudentId"
                            name="AstudentId">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentName">姓名</label>
                        <input type="text" class="form-control" id="AstudentName" placeholder="学生姓名" required [(ngModel)]="addStudentModel.StudentName"
                            name="AstudentName">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentSex">性别</label>
                        <input type="text" class="form-control" id="AstudentSex" placeholder="学生性别" required [(ngModel)]="addStudentModel.StudentSex"
                            name="AstudentSex">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentNumber">电话</label>
                        <input type="text" class="form-control" id="AstudentNumber" placeholder="学生电话" required [(ngModel)]="addStudentModel.StudentNumber"
                            name="AstudentNumber">
                    </div>
                    <div class="form-group add-input col-sm-6">
                        <label for="AstudentEmail">邮箱</label>
                        <input type="text" class="form-control" id="AstudentEmail" placeholder="学生邮箱" required [(ngModel)]="addStudentModel.StudentEmail"
                            name="AstudentEmail">
                    </div>
                </form>
            </div>
            <div class="modal-footer col-sm-12">
                <button type="button" class="btn btn-warning pull-left" (click)="clearAddModel()">重置</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary" (click)="addStudent()" [disabled]="!addForm.form.valid">确认</button>
            </div>
        </div>
    </div>
</div>

<!-- 编辑模版 -->
<div class="modal fade" id="editModel" tabindex="-2" role="dialog" aria-labelledby="编辑">
    <div class="modal-dialog" role="document">
        <div class="modal-content col-sm-12">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-inline" #editForm="ngForm">
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentGrade">年级</label>
                        <input type="text" class="form-control" id="EstudentGrade" placeholder="学生年级" required [(ngModel)]="editStudentModel.StudentGrade"
                            name="EstudentGrade">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentDepartment">系别</label>
                        <input type="text" class="form-control" id="EstudentDepartment" placeholder="学生系别" required [(ngModel)]="editStudentModel.StudentDepartment"
                            name="EstudentDepartment">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentMajor">专业</label>
                        <input type="text" class="form-control" id="EstudentMajor" placeholder="学生专业" required [(ngModel)]="editStudentModel.StudentMajor"
                            name="EstudentMajor">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentId">学号</label>
                        <input type="text" class="form-control" id="EstudentId" placeholder="学生学号" required [(ngModel)]="editStudentModel.StudentId"
                            name="EstudentId">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentName">姓名</label>
                        <input type="text" class="form-control" id="EstudentName" placeholder="学生姓名" required [(ngModel)]="editStudentModel.StudentName"
                            name="EstudentName">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentSex">性别</label>
                        <input type="text" class="form-control" id="EstudentSex" placeholder="学生性别" required [(ngModel)]="editStudentModel.StudentSex"
                            name="EstudentSex">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentNumber">电话</label>
                        <input type="text" class="form-control" id="EstudentNumber" placeholder="学生电话" [(ngModel)]="editStudentModel.StudentNumber"
                            name="EstudentNumber">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EstudentEmail">邮箱</label>
                        <input type="text" class="form-control" id="EstudentEmail" placeholder="学生邮箱" [(ngModel)]="editStudentModel.StudentEmail"
                            name="EstudentEmail">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherId">导师工号</label>
                        <input type="text" class="form-control" id="EteacherId" placeholder="导师工号" [(ngModel)]="editStudentModel.TeacherId" name="EteacherId">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherName">导师姓名</label>
                        <input type="text" class="form-control" id="EteacherName" placeholder="导师姓名" [(ngModel)]="editStudentModel.TeacherName" name="EteacherName">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherSex">导师性别</label>
                        <input type="text" class="form-control" id="EteacherSex" placeholder="导师性别" [(ngModel)]="editStudentModel.TeacherSex" name="EteacherSex">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherDepartment">导师系别</label>
                        <input type="text" class="form-control" id="EteacherDepartment" placeholder="导师系别" [(ngModel)]="editStudentModel.TeacherDepartment"
                            name="EteacherDepartment">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherNumber">导师电话</label>
                        <input type="text" class="form-control" id="EteacherNumber" placeholder="导师电话" [(ngModel)]="editStudentModel.TeacherNumber"
                            name="EteacherNumber">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EteacherEmail">导师邮箱</label>
                        <input type="text" class="form-control" id="EteacherEmail" placeholder="导师邮箱" [(ngModel)]="editStudentModel.TeacherEmail"
                            name="EteacherEmail">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EselectStatus">选题状态</label>
                        <select class="form-control" id="EselectStatus" [(ngModel)]="editStudentModel.SelectStatus" name="EselectStatus" placeholder="选题状态">
                            <option value="0">未选题</option>
                            <option value="1">待确认</option>
                            <option value="2">已选题</option>
                        </select>
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EtitleId">编号</label>
                        <input type="text" class="form-control" id="EtitleId" placeholder="题目编号" [(ngModel)]="editStudentModel.TitleId" name="EtitleId">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EtitleName">题目</label>
                        <input type="text" class="form-control" id="EtitleName" placeholder="论文题目" [(ngModel)]="editStudentModel.TitleName" name="EtitleName">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EkeyWord">关键字</label>
                        <input type="text" class="form-control" id="EkeyWord" placeholder="关键字" [(ngModel)]="editStudentModel.KeyWord" name="EkeyWord">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EsystemScore">系统得分</label>
                        <input type="text" class="form-control" id="EsystemScore" placeholder="系统得分" [(ngModel)]="editStudentModel.SystemScore" name="EsystemScore">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EtitleScore">论文得分</label>
                        <input type="text" class="form-control" id="EtitleScore" placeholder="论文得分" [(ngModel)]="editStudentModel.TitleScore" name="EtitleScore">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="Escore">总分</label>
                        <input type="text" class="form-control" id="Escore" placeholder="总分" [(ngModel)]="editStudentModel.Score" name="Escore">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="EreadStatus">查阅状态</label>
                        <select class="form-control" id="EreadStatus" [(ngModel)]="editStudentModel.ReadStatus" name="EreadStatus" placeholder="查阅状态">
                            <option value="0">未查阅</option>
                            <option value="1">已查阅</option>
                        </select>
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="Egraduation">毕业年份</label>
                        <input type="text" class="form-control" id="Egraduation" placeholder="毕业年份" [(ngModel)]="editStudentModel.Graduation" name="Egraduation">
                    </div>
                    <div class="form-group edit-input col-sm-6">
                        <label for="Elevel">评级</label>
                        <select class="form-control" id="Elevel" [(ngModel)]="editStudentModel.Level" name="Elevel" placeholder="评级">
                            <option value="0">未评级</option>
                            <option value="1">不合格</option>
                            <option value="2">合格</option>
                            <option value="3">优秀</option>
                        </select>
                    </div>
                </form>
            </div>
            <div class="modal-footer col-sm-12">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary" (click)="editStudent()" [disabled]="!editForm.form.valid">确认</button>
            </div>
        </div>
    </div>
</div>

<!-- 分配模版 -->
<div class="modal fade" id="teachModel" tabindex="-1" role="dialog" aria-labelledby="选择">
    <div class="modal-dialog" role="document">
        <div class="modal-content col-sm-12">
            <div class="modal-header">
                <button (click)="teachClear()" type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">选择导师</h4>
            </div>
            <div class="modal-body">
                <form class="form-inline">
                    <div class="form-group search-input-R1">
                        <label for="teacherDepartment">系别</label>
                        <input type="text" id="teacherDepartment" class="form-control" [(ngModel)]="teachSearch.TeacherDepartment" name="teacherDepartment">
                    </div>
                    <div class="form-group search-input-R1">
                        <label for="teacherName">姓名</label>
                        <input type="text" id="teacherName" class="form-control" [(ngModel)]="teachSearch.TeacherName" name="teacherName">
                    </div>
                    <div class="form-group search-input-R1">
                        <button type="submit" (click)="getTeacherList(null,1)" class="btn btn-primary">查询</button>
                    </div>
                </form>
                <table class="table table-bordered table-hover table-striped table-keep-line">
                    <thead>
                        <tr>
                            <th>选择</th>
                            <th>系别</th>
                            <th>工号</th>
                            <th>姓名</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let teach of teachList">
                            <td><button class="btn btn-success btn-xs" (click)="selectTeach(teach)">选择</button></td>
                            <td>{{teach.TeacherDepartment}}</td>
                            <td>{{teach.TeacherId}}</td>
                            <td>{{teach.TeacherName}}</td>
                        </tr>
                    </tbody>
                </table>
                <div class="clearfix pull-right">
                    <ul class="pagination pagination-sm no-margin">
                        <li (click)="teachChangePage('first',null)"><a>首页</a></li>
                        <li (click)="teachChangePage('pre',null)"><a class="fa fa-chevron-left"></a></li>
                        <li *ngFor="let item of teachPages" (click)="teachChangePage('page',item)" [class.active]="teachSearch.PageIndex===item"><a>{{item}}</a></li>
                        <li (click)="teachChangePage('next',null)"><a class="fa fa-chevron-right"></a></li>
                        <li (click)="teachChangePage('last',null)"><a>末页</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 学生详情 -->
<div class="modal fade" id="showStudentDetail" tabindex="-1" role="dialog" aria-labelledby="详情">
    <div class="modal-dialog" role="document">
        <div class="modal-content col-sm-12">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">学生详情</h4>
            </div>
            <div class="modal-body">
                <div><strong>年级：</strong>{{studentInfo.StudentGrade}}</div>
                <div><strong>系别：</strong>{{studentInfo.StudentDepartment}}</div>
                <div><strong>专业：</strong>{{studentInfo.StudentMajor}}</div>
                <div><strong>学号：</strong>{{studentInfo.StudentId}}</div>
                <div><strong>姓名：</strong>{{studentInfo.StudentName}}</div>
                <div><strong>性别：</strong>{{studentInfo.StudentSex}}</div>
                <div><strong>电话：</strong>{{studentInfo.StudentNumber}}</div>
                <div><strong>邮箱：</strong>{{studentInfo.StudentEmail}}</div>
            </div>
        </div>
    </div>
</div>

<!-- 导师详情 -->
<div class="modal fade" id="showTeachDetail" tabindex="-1" role="dialog" aria-labelledby="详情">
    <div class="modal-dialog" role="document">
        <div class="modal-content col-sm-12">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">导师详情</h4>
            </div>
            <div class="modal-body">
                <div><strong>系别：</strong>{{studentInfo.TeacherDepartment}}</div>
                <div><strong>工号：</strong>{{studentInfo.TeacherId}}</div>
                <div><strong>姓名：</strong>{{studentInfo.TeacherName}}</div>
                <div><strong>性别：</strong>{{studentInfo.TeacherSex}}</div>
                <div><strong>电话：</strong>{{studentInfo.TeacherNumber}}</div>
                <div><strong>邮箱：</strong>{{studentInfo.TeacherEmail}}</div>
            </div>
        </div>
    </div>
</div>